const AntTextArea = Input.TextArea;
import {Form, Input} from 'antd'
import {concat, omit} from 'ramda'
import Group from './Group'

const FormItem = Form.Item;

// type FormTextAreaPropsType = {
//     onChange?: Function,
//     initialValue?: string,
//     labelCol?: number,
//     label?: string,
//     rules?: Array,
//     required?: boolean,
//     name?: string,
//     span?: number,
//     textAlign?: 'riught' | 'cxenter' | 'left',
//     row?: number,
//     width?: string,
//     getFieldDecorator?: Function,
//     placeholder?: string,
//     justify?:string
// }

const FormTextArea = ({required, span, textAlign, width, row, name, justify,placeholder, label, getFieldDecorator, onChange, labelCol, initialValue, rules}) => (
    <Group spans={[span || 16]} justify={justify || 'center'} textAligns={[textAlign || 'left']}>
        <FormItem labelCol={{span: labelCol || 0}} wrapperCol={{span: 24 - (labelCol || 0)}} label={label}>
            {getFieldDecorator(name, {
                initialValue,
                rules: concat([{required, message: '必填项'}], rules || []),
            })(
                <AntTextArea rows={row || 6}
                             style={{width: width || '100%'}}
                             placeholder={placeholder}
                             onChange={x => onChange && onChange(x.target.value)}
                />
            )}
        </FormItem>
    </Group>
)

export  {FormTextArea,AntTextArea}